package com.yjc.hire.work.controller;

import com.yjc.hire.base.BaseInfoProperties;
import com.yjc.hire.grace.result.GraceJSONResult;
import com.yjc.hire.grace.result.PageGridResult;
import com.yjc.hire.work.bo.EditJboBO;
import com.yjc.hire.work.bo.SearchJobSBO;
import com.yjc.hire.work.service.JobService;
import com.yjc.hire.work.vo.SearchJobVO;
import com.yjc.pojo.Job;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * </p>
 *
 * @author jcyin
 * @since 2025/8/26
 * </p>
 */

@RestController
@RequestMapping("job")
public class JobController extends BaseInfoProperties {
    @Autowired
    private JobService jobService;

    @PostMapping("modify")
    public GraceJSONResult modify(EditJboBO editJboBO){
        jobService.modifyJobDetail(editJboBO);
        return GraceJSONResult.ok();
    }

    /**
     * 候选人搜索职位
     */
    @PostMapping("searchJobs")
    public GraceJSONResult searchJobs(Integer page, Integer limit, @RequestBody SearchJobSBO searchJobSBO){
        if (page == null) page = 1;
        if (limit == null) limit = 10;
        PageGridResult<List<SearchJobVO>> jobList = jobService.searchJobs(page,limit,searchJobSBO);
        return GraceJSONResult.ok(jobList);
    }



}
